﻿
@{
    ViewData["Title"] = "Index";
    Layout = "~/Shared/_LoginTemplate.cshtml";
}
@section style
{

    <link href="/vendor/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
}

@section script
{
    <script src="/vendor/jquery/jquery.form.js"></script>
    <script src="/vendor/layui/lay/modules/layer.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#LoginForm").submit(function () {
                $("#LoginForm").ajaxSubmit(function (data) {
                    if (data != undefined && data.isSuccessed != undefined) {
                        if (!data.isSuccessed) {
                            layer.alert(data.msg);
                        }
                        else {
                            location.href = "/home";
                            //layer.alert(data.msg, function () { location.href = "/home"; });
                        }
                    }
                });
                 return false;
            });
            var url = location.search;
            if (parent !== window) {
                try {
                    parent.location.href = url;
                } catch (e) {

                }
            }
            if (!url)
                return false;
            if (url.indexOf("?msg=") != -1) {
                var str = url.substr(5);
                layer.alert(decodeURI(str), function () {
                    location.href = "/";
                });

            }
        });
    </script>
}
<div class="page-wrapper flex-row align-items-center">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-5">
                <div class="card p-4">
                    <div class="card-header text-center text-uppercase h4 font-weight-light">
                        控制台系统登录
                    </div>
                    <form method="post" id="LoginForm" action="/Console/User/Login">
                        <div class="card-body py-1">
                            <div class="form-group">
                                <label class="form-control-label">账号</label>
                                <input type="text" class="form-control" name="UserName"  maxlength="32">
                            </div>

                            <div class="form-group">
                                <label class="form-control-label">密码</label>
                                <input type="password" class="form-control" name="Password" maxlength="32">
                            </div>

                            @*<div class="custom-control custom-checkbox mt-4">
                                    <input type="checkbox" class="custom-control-input" id="login">
                                    <label class="custom-control-label" for="login">记住密码</label>
                                </div>*@
                        </div>
                        <div class="card-footer">
                            <div class="row">
                                <div class="col-12">
                                    <button type="submit" class="btn btn-block btn-primary" id="submitBtn">登录</button>
                                </div>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>

